#ifndef ____SSBASEL__SSCVT__CVT_CLS__H__
#define ____SSBASEL__SSCVT__CVT_CLS__H__
/*!
* \file cvt_cls.h
* \brief
* 
*
* 
* \author patdz@qq.com
* \version 1.0
* \date 2014/05/26
*/

#include "cvt.h"

_SSL_BEGIN
_SSBASEL_BEGIN

class SSCVT_CLASS auto_cvt
{
public:
	explicit auto_cvt(const char *p, bool copy_ori_string = false);
	explicit auto_cvt(const std::string &str, bool copy_ori_string = false);
	explicit auto_cvt(const wchar_t *p, bool copy_ori_string = false);
	explicit auto_cvt(const std::wstring &str, bool copy_ori_string = false);
	auto_cvt(const auto_cvt& other);
	~auto_cvt();

	auto_cvt& operator = (const auto_cvt &rhs);

public:
	const char *c_astr();
	const wchar_t *c_wstr();
	const char *c_utf8str();
#ifdef UNICODE
	const wchar_t *c_tstr();
#else
	const char *c_tstr();
#endif

	char *astr();
	wchar_t *wstr();
	char *utf8str();
#ifdef UNICODE
	const wchar_t *tstr();
#else
	const char *tstr();
#endif

protected:
	void init(const char *p, bool copy_ori_string);
	void init(const wchar_t *p, bool copy_ori_string);
	void int_from_other(const auto_cvt &rhs);
	void uninit();
protected:
	const char *ori_string_ansi;
	const char *ori_string_utf8;
	const wchar_t *ori_string_u16;
	char *string_ansi;
	char *string_utf8;
	wchar_t *string_u16;

public:
	static auto_cvt from_fmt(const char *p, ...);
	static auto_cvt from_fmt(const wchar_t *p, ...);
};

_SSBASEL_END
_SSL_END


#endif
